<?php
	require_once(dirname(dirname(__DIR__)) . '/core.php');

?>
	<h2 class="ibar_plugin_title"><span class="ibar_plugin_name">最近查看</span></h2>
	<div class="ibar_plugin_content" style="height: 399px; overflow-y: auto;">
		<?php
			$recent = cookie('recent_goods') or $recent = '[]';
			$recent = json_decode($recent,true);	
		?>
		<div class="ibar-history-head">共<?php echo count($recent)?>件商品<a href="javascript:;" id="ibar-btn-clearhistory">清空</a>
		</div>
		<div class="ibar-moudle-product">
			<?php
				foreach($recent as $key => $val){
					$ginfo = Model()->table('goods')->find($val);
					$gminfo = Model()->table('goods_common')->where(array('goods_commonid' => $ginfo['goods_commonid']))->find();
					$sinfo = Model()->table('store')->find($ginfo['store_id']);
			?>
			<div class="imp_item">
				<a href="/shop/index.php?act=goods&goods_id=<?php echo $ginfo['goods_id']?>" title="" target="_blank" class="pic">
					<img src="/data/upload/shop/store/goods/<?php echo $sinfo['store_id']?>/<?php echo $ginfo['goods_image']?>" width="100" height="100">
				</a>
				<p class="tit"><a href="/shop/index.php?act=goods&goods_id=<?php echo $ginfo['goods_id']?>" title="" target="_blank"><?php echo $ginfo['goods_name']?></a>
				</p>
				<p class="price"><em>¥</em><?php echo $ginfo['goods_price']?></p><a href="javascript:;" target="_blnak" class="imp-addCart" key="<?php echo $ginfo['goods_id']?>" type="product" img="http://p0.jmstatic.com/product/000/507/507660_std/507660_100_100.jpg">加入购物车</a>
				<div class="sku_box">
					<select class="sku_select">
						<option value="0">型号选择</option>
					</select>
				</div>
			</div>
			<?php
				}
			?>
			
		</div>
	</div>
</div>